<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title th:text="${lic.company} + '系统安装 - 配置环境变量'"></title>
    <link rel="stylesheet" type="text/css" th:href="@{/skin/common.css}">
    <!-- 注意不能用SkinMgr.getSkin(request)，因为如果数据库连接出错，其中调用到数据库的地方就会出错 -->
    <link type="text/css" rel="stylesheet" th:href="@{/skin/lte/css.css}" />
    <link rel="stylesheet" th:href="@{/js/layui/css/layui.css}" media="all">
    <link th:href="@{/js/jquery-showLoading/showLoading.css}" rel="stylesheet" type="text/css"/>
    <style type="text/css">
        td {
            height: 34px;
        }
        input:not([type="radio"]):not([type="button"]):not([type="checkbox"]) {
            width: 200px;
        }
        .tip {
            color: #FF0000
        }
    </style>
    <script th:src="@{/inc/common.js}"></script>
    <script th:src="@{/js/jquery-3.7.1.min.js}"></script>
    <script th:src="@{/js/layui/layui.js}" charset="utf-8"></script>
    <link th:href="@{/js/jquery-showLoading/showLoading.css}" rel="stylesheet" media="screen"/>
    <script type="text/javascript" th:src="@{/js/jquery-showLoading/jquery.showLoading.js}"></script>
    <script type="text/javascript" th:src="@{/js/jquery.toaster.js}"></script>
</head>
<body>
<table cellpadding="6" cellspacing="0" border="0" width="100%" style="margin-top:20px">
    <tr>
        <td width="1%" valign="top"></td>
        <td width="99%" align="center" valign="top">
            <div align="left"><b>欢迎您使用<span th:text="${lic.company}"></span>系统 版本<span th:text="${oaVersion}"></span>
            </b></div>
            <hr size="0">
            <form id="form1" method="post">
                <table width="100%" border="0" cellpadding="0" cellspacing="0">
                    <tr>
                        <td height="25" colspan="2" align="left">配置环境变量：</td>
                    </tr>
                    <tr>
                        <td align="right">系统名称：</td>
                        <td>
                            <input type="text" name="Application.name" th:value="${appName}"/>&nbsp;
                            <input name="Application.server" th:value="${serverName}" type="hidden"/>
                            <input type="hidden" name="Application.port" th:value="${serverPort}"/>
                            <input type="hidden" name="Application.title" value=""/>
                            <input type="hidden" name="Application.desc" value=""/>
                        </td>
                    </tr>
                    <tr>
                        <td align="right">虚拟路径：</td>
                        <td align="left">
                            <input name="Application.virtualPath" th:value="${vPath}"/>（用于生成登录界面二维码）
                        </td>
                    </tr>
                    <tr>
                        <td align="right">调试状态：</td>
                        <td align="left">
                            <select id="isDebug" name="Application.isDebug">
                                <option value="true">是</option>
                                <option value="false" selected>否</option>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td align="right">单位名称：</td>
                        <td><input id="deptName" name="deptName" th:value="${deptName}"/></td>
                    </tr>
                    <tr>
                        <td align="right">集群：</td>
                        <td>
                            <select id="isCluster" name="Application.isCluster">
                                <option value="false" selected>否</option>
                                <option value="true">是</option>
                            </select>
                        </td>
                    </tr>
                    <tr id="trClusterNo" th:style="${isCluster ? '' : 'display:none'}">
                    <td align="right">显示集群编号：</td>
                    <td>
                        <select id="isClusterNoDisplay" name="Application.isClusterNoDisplay">
                            <option value="true" selected>是</option>
                            <option value="false">否</option>
                        </select>
                            <script th:inline="javascript">
                                o("Application.isClusterNoDisplay").value = "[(${isClusterNoDisplay})]";
                            </script>
                    </td>
                    </tr>
                    <tr id="trRealPath">
                        <td align="right">文件上传路径：</td>
                        <td>
                            <input id="realPath" name="realPath" style="width:400px" th:value="${realPath}"/>
                            建议：<a href="javascript:;" title="点击设置文件上传路径" th:onclick="o('realPath').value='[(${realPathRecommand})]'"><span th:text="${realPathRecommand}"></span>
                        </a>
                        </td>
                    </tr>
                    <tr style="display: none;">
                        <td align="right">服务器request是否直接支持中文：</td>
                        <td><select name="Application.isRequestSupportCN">
                            <option value="true">是</option>
                            <option value="false" selected="selected">否</option>
                        </select>
                            <script th:inline="javascript">
                                var supobj = o("Application.isRequestSupportCN");
                                supobj.value = "[(${requestSupportCN})]";
                            </script>
                            ( Tomcat 默认选是，如果使用了防乱码过滤器也选是，<span class="tip">注意慎重选用，否则在提交后可能会出现乱码</span> )
                        </td>
                    </tr>
                    <tr>
                        <td align="right">SSL安全套接字连接：</td>
                        <td><select name="Application.internetFlag">
                            <option value="secure">是</option>
                            <option value="no" selected>否</option>
                        </select>
                            <script th:inline="javascript">
                                var obj = o("Application.internetFlag");
                                obj.value = "[(${internetFlag})]";
                            </script>
                        </td>
                    </tr>
                    <tr>
                        <td align="right">系统正式启用：</td>
                        <td>
                            <select name="Application.isFormalOpen">
                                <option value="true">是</option>
                                <option value="false" selected>否</option>
                            </select>
                            <script th:inline="javascript">
                                o("Application.isFormalOpen").value = "[[${isFormalOpen}]]";
                            </script>
                            (系统如正式启用，则需以管理员身份登录才能setup)
                        </td>
                    </tr>
                    <tr>
                        <td align="right">默认时区：</td>
                        <td>
                            <select name="i18n.timeZone">
                                <option value="GMT-11:00">(GMT-11.00)中途岛，萨摩亚群岛</option>
                                <option value="GMT-10:00">(GMT-10.00)夏威夷</option>
                                <option value="GMT-09:00">(GMT-9.00)阿拉斯加</option>
                                <option value="GMT-08:00">(GMT-8.00)太平洋时间（美国和加拿大）；蒂华纳</option>
                                <option value="GMT-07:00">(GMT-7.00)山地时间（美国和加拿大）</option>
                                <option value="GMT-06:00">(GMT-6.00)中美洲</option>
                                <option value="GMT-05:00">(GMT-5.00)波哥大，利马，基多</option>
                                <option value="GMT-04:00">(GMT-4.00)加拉加斯，拉巴斯</option>
                                <option value="GMT-03:00">(GMT-3.00)格陵兰</option>
                                <option value="GMT-02:00">(GMT-2.00)中大西洋</option>
                                <option value="GMT-01:00">(GMT-1.00)佛得角群岛</option>
                                <option value="GMT">(GMT)格林威治标准时间，都柏林，爱丁堡，伦敦，里斯本</option>
                                <option value="GMT+01:00">(GMT+1.00)阿姆斯特丹，柏林，伯尔尼，罗马，斯德哥尔摩，维也纳</option>
                                <option value="GMT+02:00">(GMT+2.00)雅典，贝鲁特，伊斯坦布尔，明斯克</option>
                                <option value="GMT+03:00">(GMT+3.00)莫斯科，圣彼得堡，伏尔加格勒</option>
                                <option value="GMT+04:00">(GMT+4.00)阿布扎比，马斯喀特</option>
                                <option value="GMT+04:30">(GMT+4.30)喀布尔</option>
                                <option value="GMT+05:00">(GMT+5.00)叶卡捷琳堡</option>
                                <option value="GMT+05:30">(GMT+5.30)马德拉斯，加尔各答，孟买，新德里</option>
                                <option value="GMT+05:45">(GMT+5.45)加德满都</option>
                                <option value="GMT+06:00">(GMT+6.00)阿拉木图，新西伯利亚</option>
                                <option value="GMT+06:30">(GMT+6.30)仰光</option>
                                <option value="GMT+07:00">(GMT+7.00)曼谷，河内，雅加达</option>
                                <option value="GMT+08:00" selected="selected">(GMT+8.00)北京，台北，重庆，香港特别行政区，乌鲁木齐</option>
                                <option value="GMT+09:00">(GMT+9.00)汉城，大坂，东京，札幌</option>
                                <option value="GMT+09:30">(GMT+9.30)达尔文</option>
                                <option value="GMT+10:00">(GMT+10.00)关岛，莫尔兹比港</option>
                                <option value="GMT+11:00">(GMT+11.00)马加丹，索罗门群岛，新喀里多尼亚</option>
                                <option value="GMT+12:00">(GMT+12.00)斐济，堪察加半岛，马绍尔群岛</option>
                                <option value="GMT+13:00">(GMT+13.00)努库阿洛法</option>
                            </select>
                            <script th:inline="javascript">
                                o("i18n.timeZone").value = "[[${timeZone}]]";
                            </script>
                        </td>
                    </tr>

<!--                    <tr style="display: none">-->
<!--                        <th:block th:if="${!isDomain}">-->
<!--                             <th:block th:if="${isInnerIp}">-->
<!--                            <td align="right">外网访问OA服务器的域名或IP地址：</td>-->
<!--                            <td>-->
<!--                                <th:block th:if="${isInnerIpServer}">-->
<!--                                <input id="publicIp" name="publicIp" value=""/>-->
<!--                                </th:block>-->
<!--                                <th:block th:unless>-->
<!--                                <input id="publicIp" name="publicIp" th:value="${server}"/>-->
<!--                                </th:block>-->
<!--                                例如：www.sina.com.cn或183.232.231.1 <br/>-->
<!--                                <span class="tip">(默认无需填写，但如果存在多个访问地址，请填写外网访问OA服务器的域名或IP地址，否则会影响手机端使用)</span>-->
<!--                            </td>-->
<!--                             </th:block>-->
<!--                        </th:block>-->
<!--                    </tr>-->
                </table>
            </form>
            <hr size="0">
            <div align="center">
                <th:block th:if="${isHideStep==0}">
                    <input class="btn" type="button" th:onclick="window.location.href='[(${url})]'" value="上一步"/>
                </th:block>
                &nbsp;&nbsp;&nbsp;&nbsp;
                <input id="btnOk" class="btn" type="button" value="设置">
            </div>
        </td>
    </tr>
</table>
</body>
<script th:inline="javascript">
    $(function () {
        $('#isDebug').val('[[${getInstanceDebug}]]');

        o("isCluster").value = "[[${isCluster}]]";
        o("isClusterNoDisplay").value = "[[${isClusterNoDisplay}]]";

        $('#isCluster').change(function () {
            if ($(this).val() == "true") {
                $('#trClusterNo').show();
            } else {
                $('#trClusterNo').hide();
                $('#isClusterNoDisplay').val('false');
            }
        });

        $('#btnOk').click(function(e) {
            e.preventDefault();
            $.ajax({
                async: false,
                type: "post",
                url: "setupConfig",
                data: $('#form1').serialize(),
                dataType: "json",
                beforeSend: function (XMLHttpRequest) {
                    $('body').showLoading();
                },
                complete: function (XMLHttpRequest, status) {
                },
                success: function (data, status) {
                    $('body').hideLoading();
                    layer.alert(data.msg, '提示');
                },
                error: function (XMLHttpRequest, textStatus) {
                    $('body').hideLoading();
                    alert(XMLHttpRequest.responseText);
                }
            });
        })
    });
</script>
</html>